<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>土样详情</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit|ie-comp|ie-stand"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,user-scalable=no,minimum-scale=1,maximum-scale=1"/>
    <meta name="full-screen" content="true"/>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="true"/>
    <meta name="MobileOptimized" content="320"/>
    <meta name="screen-orientation" content="portrait"/>
    <meta name="x5-orientation" content="portrait"/>
    <meta name="full-screen" content="yes"/>
    <meta name="x5-fullscreen" content="true"/>
    <meta name="browsermode" content="application"/>
    <meta name="x5-page-mode" content="app"/>
    <meta name="msapplication-tap-highlight" content="no"/>
    <meta name="screen-orientation" content="portrait"/>
    <meta name="x5-fullscreen" content="true"/>
    <meta name="domain" content="123.57.39.2"/>
    <meta http-equiv="pragma" content="no-cache">
    <meta name="format-detection" content="telephone=no, email=no"/>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
    </script>
    <style>
        html, body {
            padding: 0;
            margin: 0;
        }

        table {
            border-collapse: separate;
            border-spacing: 0px;
        }
        td{    border-bottom: 1px solid #eee;
            line-height: 40px;color: #666;
            border-spacing: 0}
        .sheet-ctner {
            background: #FFF;
            overflow: auto;
            padding: 20px;
        }
        .td-title{
            color: #000;
            width: 30%;
            text-align: right;
        }

        .btn {
            /*position: absolute;*/
            padding: 7px 9px;
            font-size: 12px;
            border-radius: 4px;
            display: inline-block;
            line-height: 1;
            white-space: nowrap;
            cursor: pointer;
            background: #fff;
            border: 1px solid #c4c4c4;
            color: #1f2d3d;
            margin: 0;
            text-decoration: none;
        }
    </style>
</head>
<body>
<!--<h3 style="-->
<!--    text-align: center;-->
<!--    line-height: 3;-->
<!--    margin:0;-->
<!--    font-size: 24px;-->
<!--    font-weight: 400;-->
<!--">样品详情</h3>-->
<div class="sheet-ctner">
</div>
</body>
<script>
    // var domain = '1.85.30.164:8821';
    var domain = location.host;
    /**
     * window.location.search to object
     * @returns {{}}
     */
    function parseSearch(search) {
        var resultObj = {};
        var search = search || window.location.search;
        if (search && search.length > 1) {
            var search = search.indexOf('?') == 0 ? search.substring(1) : search;
            var items = search.split('&');
            for (var index = 0; index < items.length; index++) {
                if (!items[index]) {
                    continue;
                }
                var kv = items[index].split('=');
                if (resultObj[kv[0]] != undefined) {
                    if ($.isArray(resultObj[kv[0]])) {
                        // resultObj[kv[0]].push(decodeURI(kv[1])); // 解码
                        resultObj[kv[0]] += ',' + decodeURI(kv[1]);
                    } else {
                        // var ar = [resultObj[kv[0]],decodeURI(kv[1])];
                        resultObj[kv[0]] += ',' + decodeURI(kv[1]);
                    }
                } else {
                    resultObj[kv[0]] = typeof kv[1] === "undefined" ? "" : decodeURI(kv[1]); // 解码
                }
            }
        }
        return resultObj;
    }

    var searchObj = parseSearch(location.search);
    var id = searchObj.id; //read=1读取已有设置，2单纯读取不能写入
    window.onload = function () {
        $.get('http://'+domain+'/api/v1/record/qutu/' + id, function (data, status) {
            document.getElementsByClassName('sheet-ctner')[0].innerHTML = '<table style="\n' +
            '    width: 100%;\n' +
            '">\n' +
            '    <tbody>' +
                '<tr><td class="td-title">项目名称：</td><td>'+(data.data.projectName||'')+'</td></tr>' +
            '<tr><td class="td-title">任务编号：</td><td>'+(data.data.task.no||'')+'</td></tr>' +
            '<tr><td class="td-title">土样编号：</td><td>'+(data.data.no||'')+'</td></tr>' +
            '<tr><td class="td-title">土样深度：</td><td>'+(data.data.startAt+"/"+data.data.endAt)+'</td></tr>' +
            '<tr><td class="td-title">土样状态：</td><td>'+(data.data.remark3||'')+'</td></tr>' +
            '<tr><td class="td-title">土样质量等级：</td><td>'+(data.data.method1||'')+'</td></tr>' +
            '<tr><td class="td-title">取样工具和方法：</td><td>'+(data.data.method2||'')+'</td></tr>' +
            '<tr><td class="td-title">试样内容：</td><td>'+(JSON.parse(data.data.method3).method3)+'</td></tr>' +
            '<tr><td class="td-title">其他描述：</td><td>'+(data.data.remark||'')+'</td></tr>' +
            '<tr><td class="td-title">是否双样：</td><td>'+(data.data.method4=='true'?'是':'否')+'</td></tr>' +
            '<tr><td class="td-title">土的地层名称：</td><td>'+(data.data.remark2)+'</td></tr>' +
            '<tr><td class="td-title">取样时间：</td><td>'+(data.data.createAt||'')+'</td></tr>' +
            '    \n' +
            '    </tbody></table>';
        });
    };
</script>
</html>
